package com.example.ffepeg.ffe;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class IntervalFinder {
    public static void main(String[] args) {
        List<List<Integer>> list = integerList(101);
        // 打印结果
        list.forEach(group -> System.out.println(group));

    }

    private static List<List<Integer>> integerList(Integer num){
        List<Integer> numbers = IntStream.rangeClosed(0, num)
                .boxed()
                .collect(Collectors.toList());

        // 定义每组的大小
        int groupSize = 20;

        // 将列表分组
        List<List<Integer>> groupedNumbers = new ArrayList<>();
        for (int i = 0; i < numbers.size(); i += groupSize) {
            int end = Math.min(numbers.size(), i + groupSize);
            groupedNumbers.add(numbers.subList(i, end));
        }

        return groupedNumbers;
    }
}
